package cn.edu.dutir.indri.query;

import cn.edu.dutir.corpus.Topic;
import cn.edu.dutir.utility.Constants;

/**
 * An Indri query sample:
 * <pre>
  &lt;query&gt
    &lt;number&gt;710 &lt;/number &gt;
    &lt;text&gt; Prostate cancer treatments&lt;/text&gt;
  &lt;/query&gt
</pre>
 */
public class IndriQuery implements Topic {

	private int mNumber;
	private String mQueryText;

	public IndriQuery(int _num, String _text) {
		mNumber = _num;
		mQueryText = _text;
	}
	
	public int number(){return mNumber;}
	public void number(int num){mNumber = num;};
	public String queryText(){return mQueryText;}
	public void queryText(String text){mQueryText = text;}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("<query>" + Constants.NEWLINE);
		sb.append("<number>" + mNumber + "</number>" + Constants.NEWLINE);
		sb.append("<text>" + mQueryText + "</text>" + Constants.NEWLINE);
		sb.append("</query>");
		sb.append(Constants.NEWLINE);
		return sb.toString();
	}
}
